package com.saoft.fangcms.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.saoft.fangcms.common.enums.StatusEnum;
import com.saoft.fangcms.modules.sys.entity.Dict;
import com.saoft.fangcms.modules.sys.mapper.DictMapper;
import com.saoft.fangcms.modules.sys.service.DictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author scc95599
 * @since 2019-12-29
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {

    @Override
    public Dict getByNameOk(String label) {
        QueryWrapper<Dict> wrapper = new QueryWrapper<>();
        wrapper.eq("name", label);
        wrapper.eq("status", StatusEnum.OK.getCode());
        Dict one = getOne(wrapper);
        return one;
    }
}
